<% @page_title = "Create AWS Region"

options = OptionTreeGenerator.new
options.add_option(name: "name")
options.add_option(name: "provider_location_name", values: Option::AWS_LOCATIONS.map { |l| {value: l, display_name: l} })
options.add_option(name: "access_key")
options.add_option(name: "secret_key")
@option_tree, @option_parents = options.serialize %>


<%== part(
  "components/page_header",
  breadcrumbs: [
    %w[Projects project],
    [@project_data[:name], @project_data[:path]],
    ["AWS Regions", "#{@project_data[:path]}/private-location"],
    %w[Create #]
  ]
) %>

<%
  form_elements = [
    {name: "name", type: "text", label: "Ubicloud Region Name", required: "required", placeholder: "Enter name"},
    {name: "provider_location_name", type: "select", label: "AWS Region Name", required: "required", content_generator: ContentGenerator::PrivateLocation.method(:select_option), opening_tag: "<div class='col-span-6 col-start-1 md:col-end-4 xl:col-end-3'>"},
    {name: "access_key", type: "text", label: "AWS Access Key", required: "required", placeholder: "Enter AWS access key"},
    {name: "secret_key", type: "text", label: "AWS Secret Key", required: "required", placeholder: "Enter AWS secret key"}
  ]
  action = "#{@project_data[:path]}/private-location"
%>

<%== part("components/form/resource_creation_form", action:, form_elements:, option_tree: @option_tree, option_parents: @option_parents) %>
